package org.xu.controller;

import com.core.base.Reply;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.multipart.MultipartFile;
import org.xu.logic.SQLGenerateInsertLogic;
import org.xu.logic.SQLGenerateUpdateLogic;

@Slf4j
@RequestMapping("/sql/")
@Controller
public class SQLController {

    @Autowired
    private SQLGenerateUpdateLogic updateLogic;
    @Autowired
    private SQLGenerateInsertLogic insertLogic;

    @ResponseBody
    @PostMapping("/generateUpdateSQL")
    public Reply<String> generateUpdateSQL(@RequestParam("file") MultipartFile file){
        updateLogic.generateUpdateSQL(file);
        return Reply.success("finish");
    }

    @ResponseBody
    @PostMapping("/generateInsertSQL")
    public Reply<String> generateInsertSQL(@RequestParam("file") MultipartFile file){
        insertLogic.generateInsertSQL(file);
        return Reply.success("finish");
    }






}
